@extends('layouts.tankuang')

@section('content')
    <div id="allmap" style="width: 100%;height:500px;margin:0;font-family:'微软雅黑';" ></div>

    <script type="text/javascript">
        // 百度地图API功能
        var map = new BMap.Map("allmap");
        var mk;
        var point = new BMap.Point();
        map.centerAndZoom(point, 13);
        map.enableScrollWheelZoom();   //启用滚轮放大缩小，默认禁用
        map.enableContinuousZoom();    //启用地图惯性拖拽，默认禁用
        map.enableInertialDragging();


        var geolocation = new BMap.Geolocation();
        geolocation.getCurrentPosition(function (r) {
            if (this.getStatus() == BMAP_STATUS_SUCCESS) {

                map.panTo(r.point);

            }
        }, {enableHighAccuracy: true})



        //单击获取点击的经纬度
        map.addEventListener("click", function (e) {

            map.removeOverlay(mk);
            var myIcon = new BMap.Icon("{{ URL::asset('/') }}images/zuobiao.png", new BMap.Size(30, 60));
            mk = new BMap.Marker(e.point, {icon: myIcon});

            map.addOverlay(mk);

            $("input[name='jd']").val(e.point.lng);
            $("input[name='wd']").val(e.point.lat);
            //longitude1.value = e.point.lng;
            //latitude1.value = e.point.lat;

        });


        // 添加带有定位的导航控件
        var navigationControl = new BMap.NavigationControl({
            // 靠左上角位置
            anchor: BMAP_ANCHOR_TOP_LEFT,
            // LARGE类型
            type: BMAP_NAVIGATION_CONTROL_LARGE,
            // 启用显示定位
            enableGeolocation: true
        });
        map.addControl(navigationControl);
        // 添加定位控件
        var geolocationControl = new BMap.GeolocationControl();
        map.addControl(geolocationControl);

    </script>
@stop